<template>
    <div>
    <!--轮播图-->
     <mt-swipe :auto="2000">
        <mt-swipe-item v-for="(item,index) in imglist" :key="index">
            <img :src="imglist[index]" alt="">
        </mt-swipe-item>
     </mt-swipe>
    <!-- 九宫格布局 -->
    <ul class="mui-table-view mui-grid-view mui-grid-9">
      <li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3">
      <router-link to="/home/newslist">
              <img src="../../assets/images/menu1.png" alt="">
              <div class="mui-media-body">新闻资讯</div></router-link></li>
      <li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3">
      <router-link to="/home/photolist">
              <img src="../../assets/images/menu2.png" alt="">
              <div class="mui-media-body">图片分享</div></router-link></li>
      <li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3">
      <router-link to="/home/goodslist">
              <img src="../../assets/images/menu3.png" alt="">
              <div class="mui-media-body">商品购买</div></router-link></li>
      <li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3"><a href="#">
              <img src="../../assets/images/menu4.png" alt="">
              <div class="mui-media-body">留言反馈</div></a></li>
      <li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3"><a href="#">
              <img src="../../assets/images/menu5.png" alt="">
              <div class="mui-media-body">视频专区</div></a></li>
      <li class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3"><a href="#">
              <img src="../../assets/images/menu6.png" alt="">
              <div class="mui-media-body">联系我们</div></a></li>
  </ul>
    </div>
</template>
<script>
import { Toast } from 'mint-ui'
const ImageUrl = 'http://localhost/succulent/public/static/matchimage/'

export default {
    data() {
        return {
            imglist:[],  //保存轮播图的数组
        }
    },
    created() {
        this.getImg();
        //  console.log(this.imglist)          
    },
    methods: {
        getImg(){//获取轮播图数据的方法
        let vm=this
            this.axios
            .get("match/matchlist")
            .then(function(result){
                //  console.log(result.data.success)
                // 成功回调
                if(result.data.success == 1){
                    
                  result.data.massage.map((item,index)=>{
                      vm.imglist.push(ImageUrl+item.matchpic)
                    //   console.log(vm.imglist)
                  })
                  console.log(vm.imglist)                   
                }else{
                    Toast('加载不成功')
                }
            }) 
            .catch(function(result){
                 Toast('加载失败')
                // console.log('加载惩罚')
            })
            
        }
    },  
}
</script>
<style lang="scss" scoped >
    .mint-swipe{
        height:35vh;
        .mint-swipe-items-wrap{
           .mint-swipe-item{
              img{
                  width: 100%;
                  height: 100%;
              }
           }
        }        
    }
    .mui-grid-view {
        li {
            img {
            width: 60px;
            height: 60px;
            }
            div {
            font-size: 12px;
            }
        }
        }

        .mui-grid-view.mui-grid-9 {
        background-color: #fff;
        border: none;
        }

        .mui-grid-view.mui-grid-9 .mui-table-view-cell {
        border: none;
        }

        .mui-table-view.mui-grid-view .mui-table-view-cell .mui-media-body {
        font-size: 13px;
        }
</style>